﻿#ifndef SYSCFG_H
#define SYSCFG_H

#include <QString>
#include <QMutex>

class SysCfg
{
public:
    SysCfg();

    static int getIntValue(QString key, int defaultValue);

    static QString getValue(QString key, QString defaultValue);

    static int saveIntValue(QString key, int value);

    static int saveValue(QString key, QString value);

};

#define DEFAILT_LISTEN_PORT 7000

#define  KEY_CPU_ALARM_THRESHOLD "KEY_DEFAILT_LISTEN_PORT"

#define LISTEN_PORT SysCfg::getIntValue(KEY_CPU_ALARM_THRESHOLD, DEFAILT_LISTEN_PORT)
#define SAVE_LISTEN_PORT(value) SysCfg::saveIntValue(KEY_CPU_ALARM_THRESHOLD, value)


#define DEFAULT_CLIENT_LISTEN_PORT 7500
#define KEY_CLIENT_LISTEN_PORT "KEY_CLIENT_LISTEN_PORT"
#define CLIENT_LISTEN_PORT SysCfg::getIntValue(KEY_CLIENT_LISTEN_PORT, DEFAULT_CLIENT_LISTEN_PORT)
#define SAVE_CLIENT_LISTEN_PORT(value) SysCfg::saveIntValue(KEY_CLIENT_LISTEN_PORT, value)

#define DEFAULT_SEND_EMAIL_INTERVAL_SECONDS 14400
#define KEY_SEND_EMAIL_INTERVAL_SECONS "KEY_SEND_EMAIL_INTERVAL_SECONS"
#define SEND_EMAIL_INTERVAL_SECONDS SysCfg::getIntValue(KEY_SEND_EMAIL_INTERVAL_SECONS, DEFAULT_SEND_EMAIL_INTERVAL_SECONDS)
#define SAVE_SEND_EMAIL_INTERVAL_SECONDS(value) SysCfg::saveIntValue(KEY_SEND_EMAIL_INTERVAL_SECONS, value)

#define DEFAULT_SEND_EMAIL_TOS "yangpenglin@gfound.net"
#define KEY_SEND_EMAIL_TOS "KEY_SEND_EMAIL_TOS"
#define SEND_EMAIL_TOS SysCfg::getValue(KEY_SEND_EMAIL_TOS, DEFAULT_SEND_EMAIL_TOS)
#define SAVE_SEND_EMAIL_TOS(value) SysCfg::saveValue(KEY_SEND_EMAIL_TOS, value)

#define HEART_BEAT_INTERVAL_SECONDS 5


#define DEFAULT_SMTP_FROM_MAIL "agile@gfound.net"
#define KEY_SMTP_FROM_MAIL "KEY_SMTP_FROM_MAIL"
#define SMTP_FROM_MAIL SysCfg::getValue(KEY_SMTP_FROM_MAIL, DEFAULT_SMTP_FROM_MAIL)
#define SAVE_SMTP_FROM_MAIL(value) SysCfg::saveValue(KEY_SMTP_FROM_MAIL, value)




#define DEFAULT_SMTP_HOST "smtp.ym.163.com"
#define KEY_SMTP_HOST "KEY_SMTP_HOST"
#define SMTP_HOST SysCfg::getValue(KEY_SMTP_HOST, DEFAULT_SMTP_HOST)
#define SAVE_SMTP_HOST(value) SysCfg::saveValue(KEY_SMTP_HOST, value)

#define DEFAULT_SMTP_PORT 25
#define KEY_SMTP_PORT "KEY_SMTP_PORT"
#define SMTP_PORT SysCfg::getIntValue(KEY_SMTP_PORT, DEFAULT_SMTP_PORT)
#define SAVE_SMTP_PORT(value) SysCfg::saveIntValue(KEY_SMTP_PORT, value)


#define DEFAULT_SMTP_USER_NAME "agile@gfound.net"
#define KEY_SMTP_USER_NAME "KEY_SMTP_USER_NAME"
#define SMTP_USER_NAME SysCfg::getValue(KEY_SMTP_USER_NAME, DEFAULT_SMTP_USER_NAME)
#define SAVE_SMTP_USER_NAME(value) SysCfg::saveValue(KEY_SMTP_USER_NAME, value)


#define DEFAULT_SMTP_PASSWD "Gfound123$"
#define KEY_SMTP_PASSWD "KEY_SMTP_PASSWD"
#define SMTP_PASSWD SysCfg::getValue(KEY_SMTP_PASSWD, DEFAULT_SMTP_PASSWD)
#define SAVE_SMTP_PASSWD(value) SysCfg::saveValue(KEY_SMTP_PASSWD, value)

#define IMPORTANT_APPS "VIFaceFront,VIFaceCompare,VIFaceStore"

#endif // SYSCFG_H
